package com.houcine.services;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.houcine.dao.BookDAO;
import com.houcine.entity.Book;


@Transactional
public class BookService implements GenericService<Book> {

	private BookDAO dao;
	
	public Book create(Book entity) {
		dao.save(entity);
		return entity;
	}

	public void delete(Integer id) {
		Book entity = dao.getById(id);
		dao.delete(entity);
		
	}

	public Book update(Book entity) {
		dao.save(entity);
		return entity;
	}

	public List<Book> list(int page, int size) {
		return dao.list(page,size);
	}

	public BookDAO getDao() {
		return dao;
	}

	public void setDao(BookDAO dao) {
		this.dao = dao;
	}

	public Book get(Integer id) {
		return dao.getById(id);
	}

	
}
